class (Functor f) => Applicative f where   
    pure :: a -> f a   
    (<*>) :: f (a -> b) -> f a -> f b
    
instance Applicative Maybe where   
    pure = Just   
    Nothing <*> _ = Nothing   
    (Just f) <*> something = fmap f something
    
(<$>) :: (Functor f) => (a -> b) -> f a -> f b   
f <$> x = fmap f x

*Main> :t Just (3+)
Just (3+) :: Num a => Maybe (a -> a)
*Main> Just (3+) <*> Just 3
Just 6

*Main> :t pure (+) <*> Just 3
pure (+) <*> Just 3 :: Num a => Maybe (a -> a)
*Main> pure (+) <*> Just 3 <*> Just 3
Just 6

*Main> :t Just (+) <*> Just 3
Just (+) <*> Just 3 :: Num a => Maybe (a -> a)
*Main> Just (+) <*> Just 3 <*> Just 3
Just 6

*Main> :t fmap (+) (Just 3)
fmap (+) (Just 3) :: Num a => Maybe (a -> a)
*Main> fmap (+) (Just 3) <*> Just 3
Just 6

*Main> :t (+) <$> Just 3
(+) <$> Just 3 :: Num a => Maybe (a -> a)
*Main> (+) <$> Just 3 <*> Just 3
Just 6

*Main> (++) "hello" "world"
"helloworld"

*Main> (++) <$> Just "hello" <*> Just "world" 
Just "helloworld"
